package ru.papergames.model.proxies
{
	import ru.papergames.model.proxies.HTTPProxy;
	import ru.papergames.model.vo.RegistrationVO;

	public class RegistrationProxy extends MainHTTPProxy
	{
		
		public static const NAME:String = 'RegistrationProxy';
		
		//methods
		public static const TRY_REGISTER:String = 'tryRegister';
		
		//responses
		public static const TRY_REGISTER_START:String = TRY_REGISTER + HTTPProxy.START_NOTE_POSTFIX;
		public static const TRY_REGISTER_SUCCESS:String = TRY_REGISTER + HTTPProxy.SUCCESS_NOTE_POSTFIX;
		public static const TRY_REGISTER_FAULT:String = TRY_REGISTER + HTTPProxy.FAULT_NOTE_POSTFIX;
		
		public function RegistrationProxy(url:String)
		{
			super(NAME, url, new RegistrationVO());
			useOperationParam = false;
		}
		
		override public function onRegister():void {
			super.onRegister();
		}
		
		override public function onRemove():void {
			super.onRemove();			
		}
		
		
		public function get regVO():RegistrationVO {
			return this.data as RegistrationVO;
		}
		
		override protected function parseResponse(data:XML, ownResponse:Boolean):void {
			
		}
		
		/*****  Call handlers  *****/
		
		/* tryRegister */
		
		public function tryRegister_Result(data:XML):String {
			regVO.isSuccess = String(data.data.success) == 'true';
			
			return regVO.isSuccess ? TRY_REGISTER_SUCCESS : TRY_REGISTER_FAULT;
		}
		
	}
}